package com.person.android.utils;

import android.content.Context;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @autor zhaokang.
 * @time on 2015/12/9.
 */
public class AudioFormatUtils {

    private static List<String> getAudioFormats() {
        List<String> audioFormats = new ArrayList<>();
        audioFormats.add("mp3");
        audioFormats.add("wav");
        audioFormats.add("aac");
        audioFormats.add("amr");
        audioFormats.add("pcm");
        audioFormats.add("mid");
        audioFormats.add("flac");
        return audioFormats;
    }

    public static boolean isLawForAudioFormat(String format) {
        List<String> formats = getAudioFormats();
        int size = formats.size();
        for (int i = 0; i < size; i++) {
            if (formats.get(i).equals(format)) {
                return true;
            }
        }
        return false;
    }

    public static Map<String,String> getAudioSurpportedFormatsTransform(){
        Map<String,String> map = new HashMap<String,String>();
        map.put("mp3","wav,aac,ogg...");//mp3->wav,aac,ogg...
        map.put("wav","mp3,aac,ogg,wma...");//mp3->wav,aac,ogg...
        return map;
    }

}
